home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2521 < prev    next >
Encoding:
Text File  |  1996-08-05  |  866 b   |  20 lines

  1. Path: icg.resnet.upenn.edu!konrad
  2. From: konrad@icg.resnet.upenn.edu (Konrad Hernblad)
  3. Newsgroups: comp.lang.c
  4. Subject: help w/ scanf not recognizing ESC or \n
  5. Date: 22 Jan 1996 01:52:37 GMT
  6. Organization: Internet Consultants Group
  7. Message-ID: <4duql5$rg@netnews.upenn.edu>
  8. NNTP-Posting-Host: icg.resnet.upenn.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. if i ask a user to enter a string and accept the value into a variable, 
  12. say 'name', using scanf("%s", name);, is there a way to tell if the first 
  13. key (i.e. name[0]) pressed is ESC or return?  if the first key is ESC or 
  14. \n, i want to call another function.  i can do it using getch(), but i 
  15. need to use scanf() because getch() records every keystroke and i don't 
  16. want it to record when the user presses the backspace key or the 
  17. right/left arrow keys.  thanks in advance.
  18.  
  19. please email me at konrad@future.co.jp
  20.